#include <iostream>
#include <type_traits>
#include <vector>

template <typename T>
void printType(const T&) {
    if constexpr (std::is_fundamental_v<T>) {
        std::cout << "引用了基本类型" << std::endl;
    } else if constexpr (std::is_compound_v<T>) {
        std::cout << "引用了复合类型" << std::endl;
    } else {
        std::cout << "引用了其他类型" << std::endl;
    }
}

int main() {
    int basic = 42;
    std::vector<int> vec = {1, 2, 3};
    int& basicRef = basic;
    std::vector<int>& vecRef = vec;

    printType(basicRef); // 应该打印 "引用了基本类型"
    printType(vecRef);   // 应该打印 "引用了复合类型"

    return 0;
}